home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Experimental BBS Explossion 3
/
Experimental BBS Explossion III.iso
/
c
/
cujoct93.zip
/
1110084A
< prev
next >
Wrap
Text File
|
1993-08-10
|
661b
|
41 lines
/* sortargs.c: Sorts command-line arguments */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int comp(const void *, const void *);
main(int argc, char *argv[])
{
qsort(argv+1,argc-1,sizeof argv[0],comp);
while (--argc)
puts(*++argv);
return 0;
}
int comp(const void *p1, const void *p2)
{
const char *ps1 = * (char **) p1;
const char *ps2 = * (char **) p2;
return strcmp(ps1,ps2);
}
/* OUTPUT of the command "sortargs *.c"
CLOCK.C
MENU.C
PSCREEN.C
SORTARGS.C
STACK.C
STACK1.C
STACK2.C
STACK3.C
STACK4.C
TCLOCK.C
TEST2.C
TSTACK.C
TSTACK2.C
TSTACK3.C
TSTACK4.C
*/